import os

from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'course_planning.settings')
# 创建celery实例对象
app = Celery('tasks')
app.conf.timezone = 'Asia/Shanghai'
# 和Django配置文件相结合
app.config_from_object('django.conf:settings')
app.config_from_object('mycelery.config')

# 加载任务
app.autodiscover_tasks(["mycelery.sms"])
